package com.layui.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

@Controller
public class ImageController {

    @GetMapping("image")
    public String Image(){
        return "imageSubmit";
    }


    //单张图片上传
    @PostMapping("getImage")
    @ResponseBody
    public String getImage( MultipartFile file){
        System.out.println(file.getOriginalFilename());
        return null;
    }


    //多张图片上传
    @PostMapping("getImages")
    @ResponseBody
    public String getImages( @RequestParam("files") MultipartFile[] files){
        for (MultipartFile file:files) {
            System.out.println(file.getOriginalFilename());
        }
        return null;
    }
}
